<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<div th:insert="~{common/common::common}"/>
<head>
    <meta charset="UTF-8">
    <title>task</title>
</head>
<body>
    <div th:replace="~{common/leftnavbar::leftnav}"></div>
    <div class="layui-body" style="padding-top:10px;padding-left:75px;">
        <div>
            <p style="text-align: left;font-size: 200%"><b>广告黑名单实时统计</b></p>
            <p style="text-align: left;font-size: 120%">以下展示的是黑名单用户以及他们的点击次数</p>
            <p style="text-align: left;font-size: 120%">根据实时的数据，将每天对某个广告点击超过 100 次的用户拉黑</p>
        </div>
        <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>
    </div>

</body>

<script type="text/javascript">
    layui.use('table', function(){
        var table = layui.table, $ = layui.$;

        //方法级渲染
        var t = table.render({
            elem: '#LAY_table_user'
            ,url: '/black_data'
            ,parseData: function(res){ //res 即为原始返回的数据
                return {
                    "code": res.code,
                    "count": res.data.total,
                    "data": res.data.list
                };
            }
            ,cols: [
                [
                    {field:'userid', title: '用户ID', width:100, sort: true, fixed: true},
                    {field:'clickTime', title: '用户点击次数', width:200, sort: true, fixed: true}
                ]
            ]
            ,id: 'testReload'
            ,page: true
            ,height: 'full-70'
        });

        $('.demoTable .layui-btn').on('click', function(){
            var demoReload = $('#demoReload');
            t.reload({
                page: {
                    curr: 1
                }
                ,where: {
                    taskId: demoReload.val()
                }
            })
        });
    });

    function accessfunc() {
        if (document.getElementById("access").getAttribute("class")=="layui-nav-item layui-nav-itemed"){
            document.getElementById("access").setAttribute("class", "layui-nav-item");
        } else {
            document.getElementById("access").setAttribute("class", "layui-nav-item layui-nav-itemed");
        }
    }
    function categoryfunc() {
        if (document.getElementById("category").getAttribute("class")=="layui-nav-item layui-nav-itemed"){
            document.getElementById("category").setAttribute("class", "layui-nav-item");
        } else {
            document.getElementById("category").setAttribute("class", "layui-nav-item layui-nav-itemed");
        }
    }
</script>
</html>